QuickTime 3 For Windows Programmers

| Previous | Chapter Contents | Chapter Top | Next |

FSSpecToNativePathName

The FSSpecToNativePathName function extracts the native pathname from an FSSpec .

OSErr FSSpecToNativePathName(FSSpec *inFile, char *outName,
                                          unsigned long outLen, long flags);
inFile
Contains a pointer to a FSSpec .

outName
Contains a pointer to a buffer to hold a C string.

outLen
Specifies the maximum size of the buffer in bytes, including string terminator.

flags
Contains flags that control the conversion. The following flags are valid:

kFullNativePath
This indicates that the full pathname should be returned.

kFileNameOnly
Only the part of the pathname corresponding to the file should be returned. This might be useful to return a string for a window's title.

kDirectoryPathOnly
The full pathname up to and including the enclosing the directory but not the filename should be returned. This can be useful to get a path for the enclosing directory that might be used to find related files in the same directory.

As an example, consider the following Windows full path:

D:\Media\My Movies\Really Cool Movies\Tasty Fish.mov

If you have an FSSpec for this path, you can extract either the whole path or portions of the path using one of the above flags. For the above path and each flag, the resulting strings are:

Using kFullNativePath gives

D:\Media\My Movies\Really Cool Movies\Tasty Fish.mov

Using kFileNameOnly gives

Tasty Fish.mov

Using kDirectoryPathOnly gives

D:\Media\My Movies\Really Cool Movies

DISCUSSION

Sometimes, developers may need to convert a FSSpec returned by QuickTime APIs to a native pathname to be passed onto the current operating system. The FSSpecToNativePathName function accepts a FSSpec and fills in the buffer pathname whose size is pathnameMaxBufferSize with the equivalent pathname string. This size must also include the size necessary to hold the string terminator.


© 1998 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |